<?php
/**
 * trace.phtml
 * 
 * trace exceptions (only gets included on development servers)
 * 
 * @category   Madoqua
 * @package    Module
 * @subpackage Error
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl  
 */
?>
<div class="text">
    
    <h2>Exception</h2>
    <?php echo $this->error->exception->getMessage(); ?>
    
    <h2>Stack Trace</h2>
    <ol class="exception">
        <?php foreach ($this->error->exception->getTrace() as $trace) : ?>
        <li>
            <dl>
                <dt>Function</dt>
                <dd>
                <?php $class = (isset($trace['class'])) ? $trace['class'] . '::' : ''; ?>
                <?php $function = (isset($trace['function'])) ? $trace['function'] : ''; ?>
                <?php 
                if (isset($trace['function'])) {
                    $function .= '(';
                    $x = 0;
                    foreach ($trace['args'] as $arg) {
                        if ($x > 0) {
                            $function .= ', ';
                        }
                        $x++;
                        //add separating comma
    
                        if (is_object($arg)) {
                            $arg = get_class($arg);
                        }
                        //classname in case of object
                        $function .= $arg ;
                        //add argument
                    }
                    $function .= ')';
                }
                ?>
                        
                
                <?php echo $class . $function ?>
                </dd>
                
                <?php if (isset($trace['file'])) : ?>
                <dt>File</dt>
                <dd><?php echo $trace['file'] . ':' . $trace['line']; ?></dd>
                <?php endif; ?>
            </dl>
        </li>
        <?php endforeach; ?>
    </ol>
</div>